/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityBeans;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author DROWNE
 */
@Entity
@Table(name = "team")
@NamedQueries({
    @NamedQuery(name = "Team.findAll", query = "SELECT t FROM Team t"),
    @NamedQuery(name = "Team.findByIdteam", query = "SELECT t FROM Team t WHERE t.idteam = :idteam"),
    @NamedQuery(name = "Team.findByType", query = "SELECT t FROM Team t WHERE t.type = :type")})
public class Team implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idteam")
    private Integer idteam;
    @Basic(optional = false)
    @Column(name = "type")
    private int type;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "team")
    private Collection<Canuse> canuseCollection;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "team")
    private Gamesession gamesession;

    public Team() {
    }

    public Team(Integer idteam) {
        this.idteam = idteam;
    }

    public Team(Integer idteam, int type) {
        this.idteam = idteam;
        this.type = type;
    }

    public Integer getIdteam() {
        return idteam;
    }

    public void setIdteam(Integer idteam) {
        this.idteam = idteam;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public Collection<Canuse> getCanuseCollection() {
        return canuseCollection;
    }

    public void setCanuseCollection(Collection<Canuse> canuseCollection) {
        this.canuseCollection = canuseCollection;
    }

    public Gamesession getGamesession() {
        return gamesession;
    }

    public void setGamesession(Gamesession gamesession) {
        this.gamesession = gamesession;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idteam != null ? idteam.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Team)) {
            return false;
        }
        Team other = (Team) object;
        if ((this.idteam == null && other.idteam != null) || (this.idteam != null && !this.idteam.equals(other.idteam))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityBeans.Team[idteam=" + idteam + "]";
    }

}
